import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import AutoMinorLocator, MultipleLocator

plt.rcParams["font.sans-serif"] = ["STHeiti"]

# plt.xticks([0,1,2,3,4,5],['一月', '二月','三月', '四月', '五月','june'])


ax = plt.subplot()
ax.set_xlabel("时间")
ax.set_title("温度趋势")
x = np.array([1, 2, 3, 4])
y = np.array([1, 4, 2, 3])
# ax.set_xlim(0,5)#注意写法
# ax.set_xticks([0,1,2,3,4,5],['一月', '二月','三月', '四月', '五月','June'])
ax.plot(x, y, marker="o", markersize=8, mfc="white", mec="red", mew=1)  # lw=0 去掉线
ax.xaxis.set_major_locator(MultipleLocator(1))  # 主刻度间隔 1
ax.xaxis.set_minor_locator(AutoMinorLocator(4))  # 每个主刻度间增加2个次刻度
ax.grid(which="minor", color="gray", linestyle=":", linewidth=0.5, axis="both")
ax.spines["right"].set_visible(False)
ax.spines["top"].set_visible(False)
plt.show()  # Show the figure.
